package com.atguigu.tingshu.search.api;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.search.service.ItemService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Tag(name = "专辑详情管理")
@RestController
@RequestMapping("api/search")
public class itemApiController {

	private final ItemService itemService;

	public itemApiController(ItemService itemService) {
		this.itemService = itemService;
	}

	@Operation(summary = "根据专辑Id查询专辑详情")
	@Parameters({
			@Parameter(name = "albumId", description = "专辑ID", required = true)
	})
	@GetMapping("/albumInfo/{albumId}")
	public Result<Map<String, Object>> getAlbumDetail(@PathVariable Long albumId) {
		Map<String, Object> albumDetailMap = this.itemService.getAlbumDetailByAlbumId(albumId);
		return Result.ok(albumDetailMap);
	}

}

